<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <input type="text" placeholder="恶语伤人心，善语结知己">
    <button>发布</button>
    <div></div>
    <script>
        //获取元素
        const button=document.querySelector('button')
        const input=document.querySelector('input')
        const div=document.querySelector('div')
        
        button.addEventListener('click',function(){ //添加点击事件
            div.innerHTML=input.value.replace(/激情/g,'**')  //获取元素内容并替换
            input.value=''
        })

    </script>
</body>
</html>